package com.huluobo.a2307monthdemo2.adapter

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.huluobo.a2307monthdemo2.R
import com.huluobo.a2307monthdemo2.utils.ImageUtils
import com.huluobo.lib_base.bean.CartBean

/**
 *  Created by LC on 2025/10/11.
 */
class CartAdapter : BaseQuickAdapter<CartBean, BaseViewHolder>(R.layout.item_cart) {
    override fun convert(holder: BaseViewHolder, item: CartBean) {
        ImageUtils.loadImage(context, item.goods_default_icon, holder.getView(R.id.item_cart_icon_iv))
        holder.setText(R.id.item_cart_desct_tv, item.goods_desc)
        holder.setText(R.id.item_cart_price_tv, "价格:${item.goods_default_price}元")
        holder.setText(R.id.item_cart_num_tv, item.count.toString())
        holder.getView<CheckBox>(R.id.item_cart_cb).isChecked = item.isChecked
    }
}